--
-- Author: yawei.zhu
-- Date: 2018-06-29 15:16:47
--
local PvpChampionThroneGame = class("PvpChampionThroneGame")

function PvpChampionThroneGame:ctor()
end

function PvpChampionThroneGame:read(game)
	self.regOpenTime = game.RegOpenTime
	self.regCloseTime = game.RegCloseTime
	self.prepareTime = game.PrepareTime -- 战备时间（可以进入准备场的时间）
	self.battleStartTime = game.BattleStartTime -- 第一场战斗开始的时间
	-- self.isClosed = game.isClosed
    self.battleCloseTime = game.CloseTime
	self.register = game.register
	self.teamMemCount = game.teamMemCount
end

function PvpChampionThroneGame:checkChampionStatus()
    local serverTime = app.session:getServerTime() or os.time()
    local status = 0
        
    if serverTime < self.regOpenTime then
        status = Enums.ChampionStatus.NOT_OPEN
    elseif serverTime >= self.regOpenTime and serverTime < self.regCloseTime then
        status = Enums.ChampionStatus.REGISTER
    elseif serverTime >= self.regCloseTime and serverTime < self.prepareTime then
        status = Enums.ChampionStatus.PREPARE
    elseif serverTime >= self.prepareTime and serverTime < self.battleStartTime then
        status = Enums.ChampionStatus.ENTER
    elseif serverTime >= self.battleStartTime and serverTime < self.battleCloseTime then
        status = Enums.ChampionStatus.BATTLE
    else
        status = Enums.ChampionStatus.CLOSE
    end

    return status
end

function PvpChampionThroneGame:setRegister(register)
    self.register = register
end

function PvpChampionThroneGame:getRegister()
    return self.register
end

function PvpChampionThroneGame:setMemCount(count)
    self.teamMemCount = count
end

function PvpChampionThroneGame:getMemCount()
    return self.teamMemCount
end

return PvpChampionThroneGame
